<?php
/**
 * Created by PhpStorm.
 * User: lichenchen
 * Date: 2018-8-5
 * Time: 10:46
 */

namespace app\admin\controller;

use app\common\controller\AdminBase;
use app\common\model\Files;

class Layer extends AdminBase
{
    protected function initialize()
    {
        parent::initialize();
    }

    public function files()
    {
        return $this->fetch('files');
    }

    /**
     * 图片接口
     */
    public function getfiles($page = 1, $category=0)
    {
        $map =[];
        if($category){
            $map['category'] = $category;
        }
        $files_model = new Files();
        $result = $files_model->where($map)->order('id desc')->paginate(15,false,['page'=>$page]);

        return json($result);
    }

}